﻿Public Class Form1
    Public Declare Function OpencvDeviceCount Lib "OpenCVDeviceEnumerator.dll" () As Integer
    Public Declare Sub OpencvDeviceDetail Lib "OpenCVDeviceEnumerator.dll" (index As Integer, ByVal name As String, ByVal path As String)
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim count As Integer
        Dim i As Integer
        Dim showStr As String
        showStr = ""
        count = OpencvDeviceCount()
        For i = 0 To count - 1
            Dim name As String
            Dim path As String
            name = Space(100)
            path = Space(500)
            OpencvDeviceDetail(i, name, path)

            Dim name_show As String
            Dim path_show As String


            name_show = name.Remove(name.IndexOf(vbNullChar))
            path_show = path.Remove(path.IndexOf(vbNullChar))
            Console.WriteLine("---------------")
            Console.WriteLine(i)
            Console.WriteLine(name_show)
            Console.WriteLine(path_show)
            Console.WriteLine("---------------")

            showStr += i.ToString() + ":" + name_show + vbCrLf + path_show + vbCrLf

        Next

        RichTextBox1.Text = showStr
    End Sub
End Class
